POV-Ray : Newsgroups : povray.programming : complicated functions : complicated functions Server Time
28 Jul 2024 14:28:32 EDT (-0400)
  complicated functions  
From: Wlodzimierz ABX Skiba
Date: 8 Nov 2000 05:03:47
Message: <3a092503@news.povray.org>
started at p.u.p

Chris Huff wrote in message ...
>> and I want ask if there is optimized calling with the same arguments
?
>This type of optimization has been discussed a while ago, I think the
>discussion started in povray.general and spread to .programming...

unfortunately i still have 2049 in p.p and 21988 in p.g to read :-(
but only 6977 in p.b.i :-)

>Unfortunately, nobody has ever done anything about it.

than I should start, I think it could be veeeery useful
in my plant isosurface (see "is over iso vers. of plant" at p.b.i)

>There don't seem
>to be any people who understand the isosurface code well enough and
have
>the time to implement this.

I have looked at sources
and I think that there is not to much to do

>Or maybe, like me, they are simply waiting
>for 3.5 to come out

but this small change could make 3.5 much faster in such use

>> to avoid slower render time for simple isosurface
>> this feature should be switched inside isosurface
>> (i.e. keyword "fast_results")
>
>This could be done at parse time so it wouldn't slow down even the
>simplest functions, so this option would be unnecessary.

at parse time?
could you describe me how do you think you can racognize at parse
that there was previous calling in subfunction ?
yes it is possible but more complicated
see:

R=function{"R"}
func1=function{R*(R-1)}
func2=function{func1*(func1-1)}
func3=function{func2*(func2-1)}
func4=function{func3+R}

at parse you must walk on tree of calling to find that there was result
for R
I think it could be better to test during trace

>Another possibly useful feature would be the ability to use variables
in
>the function, for example:
>function {
>    A = sqr(x+y*Func(x,y,z));
>    Func2(A, A+2, x+A/2)
>}

yes, it could be very usefull
perhaps it could be done as include in structure of function
pointer to array of local variables
than at parse alloc as many entries in this table as declared local
variables
and at expresion parse after fist calling of local variable
call subfunction declared for local variable but after next calling
call to entries in table - it avoids calling of unused locals

but this way you can't referenced to local variables in other functions

>And of course, functions allowing different numbers of parameters...


this could be done like above but first with reserved entries
in described table for params, for example:

Function=function {
  /* additional parameters with default values */
  add_params[4] {2,7,0,0.1}
  /* local variable after keyword "local" finnished with ";" */
  local A = add_params[0]^2 + add_params[1];
  local B = sin(add_params[2]+add_params[3]);
  local C = A + B;
  /* old function stuff */
  C^2+7/A+4*B
}

example of possible calls:
Function
Function(x,y,z)
Function(x,y,z,14,.1)
Function(x,y,z,14,.1,10,0)

but this way you cant referenced to local variables in other functions
therefore there is also need for solution with remembered fast results
for the same parameters

I try make such patch but ...
khem... khem...
is there any free C compiler for windows or dos
which I can download to start ....

ABX


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.